# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: Exp $

EAPI=2
inherit eutils autotools

INS_DIR="/opt/cern/alice/xrootd"
# XRD_PROG_NAME="xrdbase"
# XRD_PROG_VER="${PV/./-}"

XRD_OPENSSL_DIR="/opt/cern/alice/openssl-alien-0.9.8q"

#XRD_PROG_VER="20100115-1117"
XROOTD_VER="PRO"

DESCRIPTION="ALICE ${PN} for xrootd"
SRC_URI="http://xrootd.slac.stanford.edu/download/v${PV}/${P}.tar.gz"

HOMEPAGE="http://xrootd.slac.stanford.edu/"

SLOT="3.0"
LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"

IUSE=""

CDEPEND="dev-libs/libxml2
        =dev-libs/openssl-alien-0.9.8q-r1"

DEPEND="${CDEPEND}
  dev-util/pkgconfig
  >=sci-physics/eselect-alice-1.9.7
  >=sci-physics/eselect-xrootd-2.0.3"

S="${WORKDIR}/${P}"

src_configure() {
  cd ${S}
  ./configure.classic \
  --prefix=${D}/$INS_DIR/${PV} \
  --with-ssl-incdir=$XRD_OPENSSL_DIR/include/ --with-ssl-libdir=$XRD_OPENSSL_DIR/lib/ \
  --enable-gsi --enable-secssl --no-arch-subdirs --disable-posix --enable-bonjour || die "configure failed"

}

src_compile() {
  emake OPT="${CFLAGS}" F77OPT="${FFLAGS}" || die "emake failed"
}


src_install() {
  emake DESTDIR="${D}" install || die "emake install failed"
#   dodir ${INS_DIR}/${PV}
#   dosym ${D}${INS_DIR}/${PV}/lib ${INS_DIR}/${PV}/lib64
}
